package com.example.drools_springboot.service.impl;

import com.example.drools_springboot.service.RuleService;
import org.kie.api.KieBase;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: whb
 * @Date: 2021/10/11 10:10
 * @Description
 */
@Service
public class RuleServiceImpl implements RuleService {

    @Autowired
    private KieBase kieBase;

    @Override
    public void rule() {
        KieSession session = kieBase.newKieSession();
        session.fireAllRules();
        session.dispose();
    }
}
